package cn.shop.alibaba.controller;

import cn.shop.alibaba.dto.OderParams;
import cn.shop.alibaba.resp.Result;
import cn.shop.alibaba.service.OrderService;
import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
public class OrderController {
    @Autowired
    private OrderService orderService;

    @GetMapping(value = "/submit_order")
    public String submitOrder(OderParams oderParams){
        log.info("提交订单时传递的参数:{}", JSONObject.toJSONString(oderParams));
        orderService.saveOrder(oderParams);
        return "success";
    }
}
